home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aventura Visual - História Do Mundo
/
Aventura Visual - História do Mundo.img
/
dksetup
/
win32s.inc
< prev
Wrap
Text File
|
1997-02-14
|
24KB
|
652 lines
'**************************************************************************
'* MS Test script for Win32s setup program
'**************************************************************************
''GetTempFileName flags
CONST TF_FORCEDRIVE = 128
GLOBAL DEST32S$ ''Windows\System\Win32s directory
GLOBAL DESTFREE$ ''Freecell directory
GLOBAL OLE_PROTECT% ''Indicates whether ole2 dlls were protected from being
'' copied.
GLOBAL OLE_OLEBOOT%
GLOBAL VERNUM$ '' Win32s Version Number (i.e., for v1.25 VERNUM$="125"
DECLARE SUB InstallW32s(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
DECLARE SUB RecoverFromCopy(szFileName$)
DECLARE SUB UpdateSystemIni
DECLARE FUNCTION RebootSystem(OLEONLY%) AS INTEGER
DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
DECLARE FUNCTION IsRunningApp LIB "INIUPD.DLL" AS INTEGER
'DECLARE FUNCTION SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
DECLARE FUNCTION GetTempFileName LIB "KRNL386.EXE" (drive%, prefix$, u%, filename$) AS INTEGER
DECLARE SUB WriteLine LIB "INIUPD.DLL" (filename$, text$)
DECLARE FUNCTION GetTempFileAt(szDir$, szPrefix$) as string
'
'------------------------------------------------------------------------------
'
szOldVer$ ="1.00.000 " '' Reserve space in string for version
WIN32ENABLED% = 0
OLEONLY% = 0
OLE2_16% = 0
OLE2AUTO_16% = 0
OLE16RUNAPP% = 0
OLE_PROTECT% = 0
OLE_OLEBOOT% = 0
'Start in DKSETUP.MST NOT HERE!!!
goto init
InstallWin32s:
' ON ERROR GOTO ERRNORMAL
WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
' SetTitle "Microsoft Win32s version " + WIN32SVER$ + " Setup Program"
VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
DEST32S$ = szWinSysPath + "WIN32S\"
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUITW32S
END IF
'$ENDIF ''DEBUG
CHECKW32S:
'' Check that we are not running on Chicago, including pre-released
'' Chicago versions.
IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
ExitCode% = EXITSUCCESS
WIN32ENABLED% = 1
' GOTO FREECELL
END IF
IF GetWindowsMode < 2 THEN
IF OnWindowsNT() THEN
ExitCode% = IDD_EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
ELSE
ExitCode% = IDD_EXITFAILNOTENH '' Standard Mode Windows
END IF
GOTO QUITW32S
END IF
IF OnWindowsNT() THEN
ExitCode% = EXITSUCCESS
WIN32ENABLED% = 1
' GOTO FREECELL
END IF
ExitCode% = EXITSUCCESS
' Stupid place to put this! So I've moved to after we have decided if
' they already have win32s or not..
' If IsRunningApp() <> 0 THEN
' ExitCode% = IDD_EXITFAILRUNAPP
' GOTO QUITW32S
' END IF
'' Get version of Win32s to be installed from version info in INF file
szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
'' See if OLE is included.
OLEINCLUDED% = DoesFileExist( szSrcBinPath + "\OLE2THK.DL_", femExists )
IF OLEINCLUDED% = 1 THEN
'' See whether one of the OLE 16 bit components is loaded.
IF GetModulehandle("compobj") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("ole2") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("ole2prox") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("ole2conv") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("storage") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("ole2nls") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("ole2disp") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
IF GetModuleHandle("typelib") <> 0 THEN
OLE16RUNAPP% = 1
GOTO GetOleVersion
END IF
GetOleVersion:
szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
'' Get version of currently installed OLE32 from version info of
'' ole2thk file
szOleOldVer$ = GetVersionOfFile( szWinSysPath + "WIN32S\OLE2THK.DLL" )
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "COMPOBJ.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2PROX.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "STORAGE.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2CONV.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2NLS.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2nls")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2AUTO_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2DISP.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2disp")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2AUTO_16% = 1
END IF
szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "TYPELIB.DLL" )
szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "typelib")
IF (szOle16NewVer$ > szOle16OldVer$) THEN
OLE2AUTO_16% = 1
END IF
END IF
OLE2_32% = OLEINCLUDED%
'' Check if Win32s is partially installed
sz$ = GetIniKeyString (szWinSysPath + "WIN32S.INI", "Win32s", "Setup")
'' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
IF sz$ = "0" THEN
GOTO INSTW32S
END IF
'' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
IF sz$ <> "1" THEN
GOTO INSTW32S
END IF
'' If Win32s is already installed, get running version number
i% = DoesFileExist( szWinSysPath + "W32SYS.DLL", femExists )
IF i% = 1 THEN
i% = IsWin32sLoaded( szOldVer$ )
ENDIF
IF i% = 0 THEN
GOTO INSTW32S
END IF
IF szNewVer$ > szOldVer$ THEN
GOTO INSTW32S
END IF
IF OLEINCLUDED% = 1 THEN